package com.season.seasonStudy.javase.j_021_io;
import java.io.File;

public class IO {
	public static void deleteMuLu(File f) {
		System.out.println(f.getName());
		if (f.isDirectory()) {
			File[] arr = f.listFiles();
			if (arr.length > 0) {
				for (File file : arr) {
					deleteMuLu(file);			
				}
			}
		}
		f.delete();
	}

	public static void main(String[] args) {
		deleteMuLu(new File("h:/111"));
		/*
		 * FileOutputStream out = null; try { out = new
		 * FileOutputStream("f:/abc.txt"); String a = "asdfewef我范德法特124";
		 * out.write(a.getBytes()); out.close(); } catch (FileNotFoundException
		 * e) { // TODO Auto-generated catch block e.printStackTrace(); } catch
		 * (IOException e) { // TODO Auto-generated catch block
		 * e.printStackTrace(); }
		 */

		/*
		 * try { FileInputStream in=new FileInputStream("f:/abc.txt"); byte[]
		 * a=new byte[1024]; int b=in.read(a); String c=new String(a);
		 * System.out.println(c); in.close(); } catch (FileNotFoundException e)
		 * { // TODO Auto-generated catch block e.printStackTrace(); } catch
		 * (IOException e) { // TODO Auto-generated catch block
		 * e.printStackTrace(); }
		 */
		/*
		 * FileInputStream in=null;FileOutputStream out=null; try { in = new
		 * FileInputStream("f:/abc.txt"); out = new
		 * FileOutputStream("f:/Workspaces/zwt/cba.txt");
		 * 
		 * byte[] a = new byte[2048]; while (true) { int num = in.read(a); if
		 * (num == -1) break; out.write(a, 0, num); } in.close(); out.close(); }
		 * catch (FileNotFoundException e) { // TODO Auto-generated catch block
		 * e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated
		 * catch block e.printStackTrace(); }
		 */

		/*
		 * File file=new File("f:/Workspaces/zwt/cba.txt"); file.delete();
		 */

	}
}
